#include "EngineHeader.h"

namespace LSH{

//------------------------------------------------------------------------
Texture::Texture(void)
{
}

//------------------------------------------------------------------------
Texture::~Texture(void)
{
}

//------------------------------------------------------------------------
UINT Texture::getWidth() const 
{
    if(_d3dTexture)
    {
        return _surfaceDes.Width;
    }
    return 0;
}

//------------------------------------------------------------------------
UINT Texture::getHeight() const
{
    if(_d3dTexture)
    {
        return _surfaceDes.Height;
    }
    return 0;
}

//------------------------------------------------------------------------
BOOL  Texture::loadFormFile(String& fileName)
{
    DXH_SAFE_RELEASE(_d3dTexture);
    if(FAILED(D3DXCreateTextureFromFile(Rander::GetSingleton().getD3DDevice(), fileName.c_str(), &_d3dTexture)))
    {
        return FALSE;
    }
    assert(_d3dTexture->GetLevelCount() > 0);
    _d3dTexture->GetLevelDesc(0, &_surfaceDes);

    return TRUE;
}

} // LSH
